/**
 * 全局例外处理程序
 */
package com.cnfangmao.exceptionHandler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.WebRequest;

import com.cnfangmao.common.vo.ResultVO;
import com.cnfangmao.exception.PropertyException;


@ControllerAdvice
public class GlobalExceptionHandler  {
	@ExceptionHandler(value= {PropertyException.class})
	@ResponseBody
	public ResultVO ExceptionHandler(PropertyException e,WebRequest req) throws Exception
	{
		ResultVO result=new ResultVO();
		
		result.setStatus(e.getErrorID()==0?-1:e.getErrorID());
		result.setMsg(e.getMessage());
		result.setProessor(e.getObjHandler());
		result.setResult(null);
		
		return result;
	}


}
